<!doctype html>
<html>
<head>
    <link href="../css/css.css" rel="stylesheet" type="text/css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="format-detection" content="telephone=no" />
    <meta charset="utf-8">
    <title>我的奖品</title>
    <style>
        /*订单状态*/
        .state_box{ height:43px; position:relative}
        .state{ float:left; width:50%; line-height:43px; color:#65646b; font-size:14px; text-align:center}
        .blue_block{ width:50%; position:absolute; left:0; bottom:0; height:2px; background-color:#01aff0;}
        /*订单信息*/
        .move_box{ width:100%; overflow:hidden;}
        .move{ width:500%; position:relative; clear:both; left:0}
        .order{ height:auto; position:relative; background-color:#fff; margin-bottom:40px;}
        .order_title{ line-height:40px; color:#191919; padding-left:4%; font-size:16px;}
        .order_text{ width:92%; margin-left:4%; position:relative; height:auto; padding-top:5px; box-sizing:border-box;padding-bottom:5px;}
        .order_text h1,.order_text h2{ line-height:20px; color:#191919; font-size:14px;}
        .order_text p{ position:absolute;top:10px;right:0; line-height:53px; color:#65646b; font-size:16px;}
        .cancel{ width:65px; height:25px; border:1px solid #ccc; text-align:center; line-height:25px; border-radius:3px; float:right; margin-top:6px; margin-right:4%; color:#65646b;}
        /*底部导航*/
        .nav_box{ width:100%; height:51px; position:fixed; left:0; bottom:0; background-color:#fff;}
        .nav_index,.nav_mys,.nav_order,.nav_my{ width:25%; float:left;}
        .nav_box img{ width:18px; height:auto; position:relative; left:50%; margin-left:-9px; margin-top:8px;}
        .nav_box h1{ font-size:12px; text-align:center; color:#65646b; line-height:25px;}
        .nav_box .current_nav{ color:#01aff0;}
        .border_top{
            font-size: 25px;
        }
    </style>
</head>

<body style="background-color: #f9f9f9;">
<!--header顶部标题-->
<div class="header">我的奖品
    <div class="header_left" onclick="window.history.go(-1)"><img src="../images/return.png"></div>
</div>
<!--订单状态-->
<div class="state_box">
    <div class="state">未兑换</div>
    <div class="state">已兑换</div>
    <div class="blue_block"></div>
</div>
<!--订单信息-->
<div class="move_box">
    <div class="move">

        <!--已兑换-->
        <div class="order_box1" id="jx" style="display: none;padding-bottom: 20px">
            <div style="display: none;padding: 4%" id="cc"></div>

        </div>

        <!--未兑换-->
        <div class="order_box" id="wc" style="padding-bottom: 20px">
            <div style="display: none;padding: 4%;" id="ccc"></div>

        </div>
    </div>
</div>
<!--底部导航-->
<div class="nav_box">
    <div class="border_top"></div>
    <div class="nav_index chenge" onclick="document.location='index.html';">
        <img src="../images/activity.png">
        <h1 style=" ">活动奖项</h1>
    </div>
    <div class="nav_mys chenge" onclick="document.location='change.html';">
        <img src="../images/change.png">

        <h1>兑换奖章</h1>
    </div>
    <div class="nav_my chenge" onclick="document.location='shezhi.html';" >
        <img src="../images/jiang.png">
        <h1>我的奖章</h1>
    </div>
    <div class="nav_order chenge" onclick="document.location='myorder.html';" >
        <img src="../images/user-l.png">
        <h1 style="color:#01AFF0">我的奖品</h1>
    </div>
</div>
<script src="../js/jquery-1.7.1.min.js"></script>
<script src="../js/layer/2.1/layer.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script>
    $(".state:eq(0)").click(
            function(){
                $(".blue_block").animate({left:'0%'});
                $(".order_box").css("display","block");
                $(".order_box1").css("display","none");
            }
    );
    $(".state:eq(1)").click(
            function(){
                $(".blue_block").animate({left:'50%'});
                $(".order_box1").css("display","block");
                $(".order_box").css("display","none");
                var divs=$("#jx .order");
                console.log(divs);
                // console.log(divs);

                if(divs.length>0){

                    //  alert("你好");
                    divs.remove();
                }
                $.ajax({
                    type: 'POST',
                    url: urls+'/drawRecord/findUserOfPrize',
                    contentType: "application/json",
                    success: function(req){
                    console.log(req);
                        if(req.length>0)
                        {
                            var strs="";
                            var paths="";
                            for (var i=0;i<req.length;i++){
                                if(req[i].cashPrizeState==1){
                      
                                   (req[i].prize.name==""||req[i].prize.name==null)? req[i].prize.name="没有标题":req[i].prize.name;
                      			  (req[i].prize.endTime=="" ||req[i].prize.endTime==null)? req[i].prize.endTime="0000-00-00 00:00:00":req[i].prize.endTime;
                      			   paths=urls+req[i].prize.prizeImgurl;
                      	
                     			   (req[i].prize.prizeImgurl=="" || req[i].prize.prizeImgurl==null)? paths="../upload/present.jpg":paths;
		
                                    strs=strs+'<a href="spList2.html?id='+req[i].prize.id+'">'+
                                            '<div class="order">'+
                                            '<div class="border_top"></div>'+
                                            '<div style=" height:100%;width: 4%;position:absolute; background-color:pink; "><img style="width: 100%;height:100%;" src="'+paths+'"></div>'+
                                            '<div class="order_title">'+req[i].prize.name+'</div>'+
                                            '<div class="order_text">'+
                                            '<div class="border_top"></div>'+
                                            '<h1>截止时间：'+req[i].prize.endTime.substr(0,10)+'&nbsp;&nbsp;&nbsp;&nbsp;'+req[i].prize.endTime.substr(10)+'</h1>'+
                                            '<div class="border_bottom"></div>'+
                                            '</div>'+
                                            '<div class="border_bottom"></div>'+
                                            '</div>'+
                                            '</a>';
                                }
                            }
                            $("#jx").append(strs);
                        }

                    },
                    error:function(){
                        layer.msg("请求失败");
                    }

                });
            }
    );

    $.ajax({
        type: 'POST',
        url: urls+'/drawRecord/findUserOfPrize',
        contentType: "application/json",
        success: function(req){
            console.log(req);
            if(req.length>0)
            {
                var strs="";
                for (var i=0;i<req.length;i++){
                    console.log(i);
                    var paths="";
                    if(req[i].cashPrizeState==0){
                        (req[i].prize.name==""||req[i].prize.name==null)? req[i].prize.name="没有标题":req[i].prize.name;
                        (req[i].prize.endTime=="" ||req[i].prize.endTime==null)? req[i].prize.endTime="0000-00-00 00:00:00":req[i].prize.endTime;
                         paths=urls+req[i].prize.prizeImgurl;
                      	
                        (req[i].prize.prizeImgurl=="" || req[i].prize.prizeImgurl==null)? paths="../upload/present.jpg":paths;

                        strs=strs+'<a href="spList.html?id='+req[i].prize.id+'">'+
                                '<div class="order">'+
                                '<div class="border_top"></div>'+
                                '<div style=" height:100%;width: 4%;position:absolute; background-color:pink; "><img style="width: 100%;height:100%;" src="'+paths+'"></div>'+
                                '<div class="order_title">'+req[i].prize.name+'</div>'+
                                '<div class="order_text">'+
                                '<div class="border_top"></div>'+
                                '<h1>截止时间：'+req[i].prize.endTime.substr(0,10)+'&nbsp;&nbsp;&nbsp;&nbsp;'+req[i].prize.endTime.substr(10)+'</h1>'+
                                '<div class="border_bottom"></div>'+
                                '</div>'+
                                '<div class="border_bottom"></div>'+
                                '</div>'+
                                '</a>';
                    }

                }
                $("#wc").append(strs);

            }

        },
        error:function(){
            layer.msg("请求失败");
        }

    });

</script>
</body>
</html>

